package org.vectrics.mail;

import java.util.Locale;

import org.apache.ecs.html.Body;
import org.apache.ecs.html.Head;
import org.apache.ecs.html.Html;
import org.apache.log4j.Logger;
import org.vectrics.common.html.Cell;
import org.vectrics.domain.Domain;

public abstract class EmailTemplate {
	private Html html = null;
	private Head head = null;
	private Body body = null;
	private Domain domain = null;
	private Locale locale = null;
	protected Logger log = Logger.getLogger(this.getClass());
	
	
	public EmailTemplate() {
		super();
	}

	abstract protected void doRender();
	
	public void render() {
		html = new Html();
		head = new Head();
		html.addElement(head);
		body = new Body();
		html.addElement(body);
		doRender();
	}
	
	public Locale getLocale() {
		return locale;
	}



	public void setLocale(Locale locale) {
		this.locale = locale;
	}



	public void setDomain(Domain domain) {
		this.domain = domain;
	}



	protected abstract Cell getContentCell();

	public Body getBody() {
		return(this.body);
	}
	
	public Html getHtml() {
		return(this.html);
	}
	
	public Head getHead() {
		return(this.head);
	}
	
	public Domain getDomain() {
		return(this.domain);
	}
}
